<template>
  <div id="add">
    <div class="header">
      <div class="left"></div>
      <div class="serch">
        <p>上海</p>
        <input type="text" placeholder="请输入小区或者地址" />
      </div>
      <div class="right"></div>
    </div>
    <div class="filter-title">
      <p>区域</p>
      <p>方式</p>
      <p>租金</p>
      <p>筛选</p>
    </div>
    <div class="contect" v-for="(item, index) in list" :key="index">
      <div class="pic">
        <img src="" alt="" />
      </div>
      <div class="txt">
        <h3>{{ item.title }}</h3>
        <div class="info">{{ item.desc }}</div>
        <span>{{ item.tags[0] }}</span>
        <div class="price">{{ item.price }}元/月</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "RentHouseFindHouse",

  data() {
    return {
      list: [],
    };
  },

  created() {
    this.getHouseList();
  },

  methods: {
    async getHouseList() {
      try {
        const { body } = await this.$http({
          url: "houses?cityId=AREA%7Cdbf46d32-7e76-1196&stat=1&end=10",
        });
        console.log(body);
        this.list = body.list;
      } catch (err) {
        console.log(err);
      }
    },
  },
};
</script>

<style lang="less" scoped>
#add {
  padding-bottom: 30px;
  html {
    padding: 0;
    margin: 0;
  }
  .header {
    width: 100%;
    height: 50px;
    padding: 0 6px 0 8px;
    background-color: #21b97a;
    display: flex;
    align-items: center;
    .left {
      width: 16px;
      height: 16px;
      background-color: red;
    }
    .right {
      width: 25px;
      height: 25px;
      background-color: red;
    }
    .serch {
      flex: 1;
      height: 30px;
      margin: 0 10px;
      padding: 5px 5px 5px 8px;
      border-radius: 3px;
      background-color: #fff;
      border: none;
      display: flex;
      align-items: center;
      p {
        &::after {
          content: "|";
          padding: 0 2px 0 12px;
          color: #9c9fa1;
          font-size: 15px;
          margin-right: 20px;
        }
      }
      input {
        flex: 1;
        height: 30px;
        padding-top: 5px;
        border-radius: 3px;
        border: none;
        position: relative;
        &::before {
          content: "|";
          height: 25px;
          width: 25px;
          padding: 0 2px 0 12px;
          color: #9c9fa1;
          font-size: 15px;
        }
      }
    }
  }
  .filter-title {
    position: sticky;
    top: 0;
    left: 0;
    text-align: center;
    background-color: #fff;
    height: 40px;
    border-bottom: 1px solid #e4e6f0;
    display: flex;
    align-items: center;
    p {
      width: 25%;
    }
  }
  .contect {
    height: 120px;
    border-bottom: 1px solid #e4e6f0;
    display: flex;
    align-items: center;
    .pic {
      width: 106px;
      height: 80px;
      background-color: skyblue;
      margin-right: 15px;
    }
    .txt {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      h3 {
        font-size: 15px;
        color: #394043;
        margin: 0 5px;
        overflow: hidden;
      }
      .info {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: middle;
        font-size: 12px;
        color: #afb2b3;
        margin: 5px 0;
      }
      span {
        display: inline-block;
        font-size: 12px;
        border-radius: 3px;
        padding: 4px 5px;
        width: 60px;
        margin-right: 5px;
        line-height: 12px;
        background-color: #21b97a;
      }
      .price {
        margin-top: 5px;
        font-size: 12px;
        color: #fa5741;
      }
    }
  }
}
</style>
